#ifndef _CONSUMER_H
#define _CONSUMER_H

#include "01_Thread.hpp"
#include "02_TaskQueue.hpp"
#include <time.h>
#include <unistd.h>     // unix standard
#include <stdlib.h>
#include <stdio.h>

class Consumer
:public Thread
{
public:
    Consumer(TaskQueue& taskque)
        :_taskque(taskque){}
    ~Consumer() = default;

    void run() override
    {
        sleep(4);
        //srand(time(nullptr));
        while(1){
            sleep(1);
            int num = _taskque.pop();
            printf("Consumer | output num = %d \n", num);
        }
        
    }
private:
    TaskQueue& _taskque;
};

#endif

